package com.cheejee.goodscenter.module.vo;

import com.cheejee.goodscenter.module.entity.CategoryPropertiesTemplate;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Builder;
import lombok.Data;

/**
 * @author CARRY
 * @Date 2020年10月30日下午4:06:24
 */
@Data
@Builder
@ApiModel("分类属性模板")
public class CategoryPropertiesTemplateVo {

	@ApiModelProperty("分类ID")
    private Integer categoryId;

	@ApiModelProperty("分类属性分组ID")
    private Integer categoryPropertiesGroupId;

	@ApiModelProperty("属性名")
    private String propertiesName;

	@ApiModelProperty("是否必填")
    private boolean required;

	@ApiModelProperty("属性类型：1=商品属性模板，2=SKU属性模板")
    private Byte type;

	@ApiModelProperty("描述")
    private String describe;
	
	public static CategoryPropertiesTemplate convert(Integer id, CategoryPropertiesTemplateVo vo) {
		return new CategoryPropertiesTemplate(id, vo.getCategoryId(), vo.getCategoryPropertiesGroupId(), vo.getPropertiesName(), vo.required, vo.getType(), null, vo.getDescribe());
	}
}